<?php
/**
 * Copyright (c) 2012, xxworkshop Inc.
 * All rights reserved.
 *
 * Created by BrocheXu on 2014.11.7
 */
require_once 'config/messagetype.config.inc.php';

class BaseDistributor {
	function distribute($postObject) {}
	
	function process($postObject) {
		$filename = $this->distribute($postObject);
		if (file_exists($filename)) {
			include_once $filename;
			$responseHandler = new ResponseHandler($postObject);
			return $responseHandler;
		}
	}
	
	function isTextMsg($postObject) {
		return $postObject->MsgType == MSG_TYPE_TEXT;
	}
	
	function isImageMsg($postObject){
		return $postObject->MsgType == MSG_TYPE_IMAGE;
	}
	
	function isVoiceMsg($postObject) {
		return $postObject->MsgType == MSG_TYPE_VOICE;
	}
	
	function isVideoMsg($postObject){
		return $postObject->MsgType == MSG_TYPE_VIDEO;
	}
	
	function isLocationMsg($postObject) {
		return $postObject->MsgType == MSG_TYPE_LOCATION;
	}

	function isLinkMsg($postObject){
		return $postObject->MsgType == MSG_TYPE_LINK;
	}
	
	function isEventMsg($postObject){
		return $postObject->MsgType == MSG_TYPE_EVENT;
	}

}
?>